package com.kuangshenJVM.chapter08;

import java.util.Random;

public class test08 {
    public static void main(String[] args) {

        //返回虚拟机试图使用的最大内存：是电脑总内存的1/4
        long maxMemory = Runtime.getRuntime().maxMemory();

        //返回虚拟机的总内存:又叫初始化内存，是电脑总内存的1/64
        long totalMemory = Runtime.getRuntime().totalMemory();

        System.out.println("max = " + maxMemory + "字节 \t"
                +maxMemory/(double)1024/1024 + "MB" );
        System.out.println("totalMemory = " + totalMemory
                + "字节 \t" +totalMemory/(double)1024/1024 + "MB" );

        String str = "xxx";
        while (true){
            str += str + new Random().nextInt(888888888) + new Random().nextInt(888888888);
        }
    }
}
